package net.blank.ui.core
{
	import flash.display.Sprite;
	
	import net.blank.commonInterface.IDestructible;
	import net.blank.commonInterface.IRecyclable;
	import net.blank.dataTransformation.mapping.IMapable;
	
	/**
	 * UI的抽象基类
	 * @author blank
	 * 
	 */
	public class AbstractUI extends Sprite implements IMapable, IDestructible, IRecyclable
	{
		/**
		 * 可映射
		 */
		protected namespace mapable;
		
		/**
		 * 已经被摧毁
		 */
		private var _destroyed:Boolean=false;
		
		/**
		 * 移除所有子对象
		 * 
		 */
		public function removeAllChildren():void{
			while(numChildren){
				removeChildAt(0);
			}
		}
		
		/**
		 * UI的抽象基类
		 * 
		 */
		public function AbstractUI(){
			super();
			
			reset();
		}
		
		public function get mapableNS():Namespace{
			return mapable;
		}
		
		public function mapComplete():void{}
		
		public function get destroyed():Boolean{
			return _destroyed;
		}
		
		public function destroy():void{
			_destroyed=true;
		}
		
		public function reset():void{}
	}
}